package org.template.example;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

@Entity
@Table(name = "bar_details")
public class BarDetails {

  @Id
  @GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "bar"))
  @GeneratedValue(generator = "generator")
  @Column(name = "BAR_ID", unique = true, nullable = false)
  long barId;

  @OneToOne(fetch = FetchType.LAZY)
  @PrimaryKeyJoinColumn
  Bar bar;

  @Column(name = "ADDRESS", unique = true, nullable = false, length = 256)
  String address;

  @Column(name = "PHONE", unique = true, nullable = false, length = 32)
  String phone;

  public BarDetails() {

  }

  public long getBarId() {
    return barId;
  }

  public void setBarId(long barDetailsId) {
    this.barId = barDetailsId;
  }

  public Bar getBar() {
    return bar;
  }

  public void setBar(Bar bar) {
    this.bar = bar;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

}
